package com.shuda.business.crm.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.shuda.business.crm.entity.CustomerEntity;
import com.shuda.business.crm.entity.FollowUpRecordEntity;
import com.shuda.business.crm.entity.AllocationRecordEntity;
import com.shuda.common.dto.CustomerDTO;
import com.shuda.common.dto.FollowUpRecordDTO;
import com.shuda.common.dto.AllocationRecordDTO;

import java.time.LocalDateTime;

/**
 * CRM服务接口
 */
public interface CrmService {

    /**
     * 客户管理相关方法
     */
    IPage<CustomerEntity> getCustomerList(Integer pageNum, Integer pageSize, String customerName, String phone, String status, Long channelId, Long assignedUserId);

    CustomerEntity getCustomerById(Long id);

    Boolean createCustomer(CustomerDTO customerDTO);

    Boolean updateCustomer(Long id, CustomerDTO customerDTO);

    Boolean deleteCustomer(Long id);

    Boolean updateCustomerStatus(Long id, String status);

    Boolean addFollowUpRecord(Long customerId, FollowUpRecordDTO followUpDTO);

    Boolean assignCustomer(Long customerId, Long userId);

    Boolean transferCustomer(Long customerId, Long targetUserId);

    Boolean markCustomerInvalid(Long customerId, String invalidReason);

    String exportCustomers(String query);

    /**
     * 跟进记录相关方法
     */
    IPage<FollowUpRecordEntity> getFollowUpList(Integer pageNum, Integer pageSize, Long customerId, String followUpMethod, LocalDateTime startTime, LocalDateTime endTime);

    FollowUpRecordEntity getFollowUpById(Long id);

    Boolean createFollowUp(FollowUpRecordDTO followUpDTO);

    Boolean updateFollowUp(Long id, FollowUpRecordDTO followUpDTO);

    Boolean deleteFollowUp(Long id);

    /**
     * 分配记录相关方法
     */
    IPage<AllocationRecordEntity> getAllocationList(Integer pageNum, Integer pageSize, Long customerId, Long assignedUserId, String status, LocalDateTime startTime, LocalDateTime endTime);

    AllocationRecordEntity getAllocationById(Long id);

    Boolean manualAllocation(AllocationRecordDTO allocationDTO);

    Boolean processAllocation(Long id, String processRemark);

    Boolean deleteAllocation(Long id);

    String exportAllocations(String query);
}